<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>宿舍智能防火防盗系统</title>
  <script src="./index.js"></script>
</head>

<body>
  <!-- 设置 -->
  <!-- <input type="text" id="txtPort" value="COM2" /><br /> -->
  <!-- 波特率:<input type="text" id="txtBaudRate" value="9600" />
  数据位:<input type="text" id="txtDataBits" value="8" />
  停止位:<input type="text" id="txtStopBits" value="1" />
  校验位:<input type="text" id="txtParity" value="0" /> -->
  <!-- <button onclick="sendData()">发送</button>
  <button onclick="recvData()">接收</button>
  <button onclick="startCyclicRecvData()">循环接收</button>
  <button onclick="stopCyclicRecvData()">取消循环接收</button> -->
  <!-- <div>
    <button id="open" onclick="testOpen()">打开串口</button>
    <button id="close" onclick="testClose()">关闭串口</button>
  </div> -->
  <!-- <br><br><br><br><br><br><br><br><br> -->


  <div class="box">
    <h1>宿舍防火防盗系统监控平台</h1>
    <button id="open">授权连接串口</button>
    <div id="content">
      <div class="flex-row">
        <div class="item">
          烟雾：<span id="smoke"></span>
        </div>
        <div style="width: 50px;height: 100px;"></div>
        <div class="item">
          温度：<span id="temperature"></span>
        </div>
      </div>
      <div class="flex-row">
        <div class="item">
          是否有人：<span id="isBody"></span>
        </div>
        <div style="width: 50px;height: 100px;"></div>
        <div class="item">
        </div>
      </div>
      <div class="flex-row">
        <div class="item">
          报警状态：<span id="isAlarm"></span>
        </div>
        <div style="width: 50px;height: 100px;"></div>
        <div class="item">
          风扇状态：<span id="isFan"></span>
        </div>
      </div>
      <div class="flex-row">
        <div class="item">
          布防状态：<span id="isProtection"></span>
        </div>
        <div style="width: 50px;height: 100px;"></div>
        <div class="item">
        </div>
      </div>
      <div class="flex-row">
        启用手动报警：<div class="toggle-button-cover">
          <div class="button-cover">
            <div class="button r" id="button-3">
              <input type="checkbox" class="checkbox" />
              <div class="knobs"></div>
              <div class="layer"></div>
            </div>
          </div>
        </div>
        <!-- <span id="isManual"></span> -->
      </div>
    </div>
  </div>
  </div>
</body>

<style>
  * {
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  *:focus {
    outline: none;
  }

  #open {
    width: 200px;
    height: 60px;
    background-color: #007bff;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 20px;
    color: #fff;
  }

  .box {
    width: 100%;
    height: 100vh;
    background-color: rgba(140, 231, 227, .5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  #content {
    width: 1000px;
    font-size: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .flex-row {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .item {
    width: 100%;
    height: 100px;
    display: flex;
    flex: 1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  /* Button 3 */


  body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background-color: #f1f9f9;
  }

  #app-cover {
    display: table;
    width: 600px;
    margin: 40px auto;
    counter-reset: button-counter;
  }

  .row {
    display: table-row;
  }

  .toggle-button-cover {
    display: table-cell;
    position: relative;
    width: 200px;
    height: 140px;
    box-sizing: border-box;
  }

  .button-cover {
    height: 100px;
    margin: 20px;
    /* background-color: #fff; */
    /* box-shadow: 0 10px 20px -8px #c5d6d6; */
    border-radius: 4px;
  }

  .button-cover:before {
    counter-increment: button-counter;
    content: counter(button-counter);
    position: absolute;
    right: 0;
    bottom: 0;
    color: #d7e3e3;
    font-size: 12px;
    line-height: 1;
    padding: 5px;
  }

  .button-cover,
  .knobs,
  .layer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }

  .button {
    position: relative;
    top: 50%;
    width: 74px;
    height: 36px;
    margin: -20px auto 0 auto;
    overflow: hidden;
  }

  .button.r,
  .button.r .layer {
    border-radius: 100px;
  }

  .button.b2 {
    border-radius: 2px;
  }

  .checkbox {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
  }

  .knobs {
    z-index: 2;
  }

  .layer {
    width: 100%;
    background-color: #ebf7fc;
    transition: 0.3s ease all;
    z-index: 1;
  }

  #button-3 .knobs:before {
    content: 'YES';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 10px;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    line-height: 1;
    padding: 9px 4px;
    background-color: #03a9f4;
    border-radius: 50%;
    transition: 0.3s ease all, left 0.3s cubic-bezier(0.18, 0.89, 0.35, 1.15);
  }

  #button-3 .checkbox:active+.knobs:before {
    width: 46px;
    border-radius: 100px;
  }

  #button-3 .checkbox:checked:active+.knobs:before {
    margin-left: -26px;
  }

  #button-3 .checkbox:checked+.knobs:before {
    content: 'NO';
    left: 42px;
    background-color: #f44336;
  }

  #button-3 .checkbox:checked~.layer {
    background-color: #fcebeb;
  }
</style>

</html>